/*
 * @Author: wangtao
 * @Date: 2020-07-11 15:43:52
 * @LastEditors: zeki mini
 * @LastEditTime: 2021-04-21 15:26:02
 * @Description: 保险保理路由管理文件
 *  此路由文件主要用于子app的管理文件，主要是router.js过于庞大，此处的用法与router.js中一样，并且能互通，
 *
 * 重要的点！重要的点！重要的点！ 建议命名带上Insurance-XXX
 * 但是有个及其重要的点，多个路由文件的路由命名不可重复，目前没实现自动化混淆命名
 */

import { Platform, PixelRatio } from 'react-native';
import { createBottomTabNavigator } from 'react-navigation-tabs';

// 保理平台首页
import InsuranceMain from './pages/insurance-platform/main';
import InsuranceApply from './pages/insurance-platform/apply';
import InsuranceUser from './pages/insurance-platform/user';
import InsuranceApplyForm from './pages/insurance-platform/apply-form';
import InsuranceFeedBack from './pages/insurance-platform/components/insurance-feedback';
import InsuranceApplyListMy from './pages/insurance-platform/apply-list-my'; // 我的申请列表
import InsuranceApplyMy from './pages/insurance-platform/apply-my'; // 我的申请列表
import InsuranceUpload from './pages/insurance-platform/insurance-upload'; // 我的申请列表
import InsuranceListMy from './pages/insurance-platform/insurance-list-my'; // 我的申请列表
import InsuranceDetail from './pages/insurance-platform/insurance-detail'; // 我的申请列表
import InsuranceArticleDetail from './pages/insurance-platform/main/insurance-article-detail'; // 文章详情
import InsuranceArticleList from './pages/insurance-platform/main/article-list'; // 文章列表
import PersonCertification from './pages/insurance-platform/person-certification'; // 个人认证
import CertiKnow from './pages/insurance-platform/business-certi/certi-know'; // 企业认证须知
import BusinessInfoCerti from './pages/insurance-platform/business-certi/business-info-certi-one'; // 企业信息认证
import LegalInfoCerti from './pages/insurance-platform/business-certi/legal-info-certi-two';// 法人信息认证
import CorporateAccountInfoCerti from './pages/insurance-platform/business-certi/corporate-account-certi-three'; // 对公账户信息填写
import BusinessManageSetCerti from './pages/insurance-platform/business-certi/business-manager-certi-four'; // 企业管理员设置
import BusinessCertiFeedBack from './pages/insurance-platform/business-certi/business-certi-feedback'; // 企业认证反馈页面
import B2BCorporateAccountBankSelect from './pages/insurance-platform/business-certi/corporate-account-bank-select'; // 对公账户-选择银行
import BusinessData from './pages/insurance-platform/business-certi/business-data'; // 企业资料 查看审核状态页面
import B2BBusinessInfoVerify from './pages/insurance-platform/business-certi/submited-verify-status/business-info-verify'; // 企业信息-重新提交审核页面
import B2BLegalInfoVerify from './pages/insurance-platform/business-certi/submited-verify-status/legal-info-verify'; // 法人信息-重新认证页面
import B2BCorporateAccountInfoVerify from './pages/insurance-platform/business-certi/submited-verify-status/corporate-account-info-verify'; // 对公账户-重新认证页面
import B2BBusinessManagerSetVerify from './pages/insurance-platform/business-certi/submited-verify-status/business-manager-set-verify'; // 管理员设置-重新认证页面

const isAndroid = Platform.OS === 'android';

// 底部公共配置tabNavigator
const tabNavigatorOptions = {
  tabBarOptions: {
    labelStyle: {
      fontSize: 12,
    },
    allowFontScaling: false,
    activeBackgroundColor: '#fff',
    inactiveBackgroundColor: '#fff',
    activeTintColor: '#BA914A',
    style: {
      borderTopWidth: 1 / PixelRatio.get(),
      borderTopColor: '#F0EFEF',
    },
  },
  lazy: true,
  animationEnabled: false,
  swipeEnabled: false,
};

// header为空的属性
const emptyHeader = {
  header: null,
  navigationOptions: {
    header: null,
    headerBackTitle: null,
  },
};
// 标题局中
const titleCenter = {
  headerTitleStyle: {
    alignSelf: 'center',
    textAlign: 'center',
    flex: 1,
    paddingRight: isAndroid ? 56 : 0,
    fontSize: 18,
  },
};
const InsuranceTabNavigator = createBottomTabNavigator(
  {
    InsuranceMain: {
      screen: InsuranceMain,
    },
    InsuranceApply: {
      screen: InsuranceApply,
    },
    InsuranceUser: {
      screen: InsuranceUser,
    },
  },
  {
    initialRouteName: 'InsuranceMain',
    ...tabNavigatorOptions,
  },
);

export default InsuranceRouter = {
  // 保理平台3个tab页面
  InsuranceTab: {
    screen: InsuranceTabNavigator,
    ...emptyHeader,
  },
  InsuranceFeedBack: {
    screen: InsuranceFeedBack,
    navigationOptions: {
      ...emptyHeader,
      gesturesEnabled: false,
    },
  },
  InsuranceApplyForm: {
    screen: InsuranceApplyForm,
    navigationOptions: {
      headerTitle: '一键申请',
      ...titleCenter,
    },
  },
  InsuranceApplyListMy: {
    screen: InsuranceApplyListMy,
    ...emptyHeader,
  },
  InsuranceApplyMy: {
    screen: InsuranceApplyMy,
    navigationOptions: {
      headerTitle: '我的申请',
      ...titleCenter,
    },
  },
  InsuranceUpload: {
    screen: InsuranceUpload,
    navigationOptions: {
      headerTitle: '上传保单',
      ...titleCenter,
    },
  },
  InsuranceListMy: {
    screen: InsuranceListMy,
    navigationOptions: {
      headerTitle: '我的保单',
      ...titleCenter,
    },
  },
  InsuranceDetail: {
    screen: InsuranceDetail,
    navigationOptions: {
      headerTitle: '保单详情',
      ...titleCenter,
    },
  },
  InsuranceArticleDetail: {
    screen: InsuranceArticleDetail,
    navigationOptions: {
      headerTitle: '',
      ...titleCenter,
    },
  },
  InsuranceArticleList: {
    screen: InsuranceArticleList,
    navigationOptions: {
      headerTitle: '更多头条',
      ...titleCenter,
    }
  },
  PersonCertification: {
    screen: PersonCertification,
    navigationOptions: {
      headerTitle: '完善个人资料',
      ...titleCenter,
    },
  },
  CertiKnow: {
    screen: CertiKnow,
    navigationOptions: {
      headerTitle: '企业认证须知',
      ...titleCenter,
    },
  },
  BusinessInfoCerti: {
    screen: BusinessInfoCerti,
    navigationOptions: {
      headerTitle: '企业信息填写',
      ...titleCenter,
    },
  },
  LegalInfoCerti: {
    screen: LegalInfoCerti,
    navigationOptions: {
      headerTitle: '法人信息填写',
      ...titleCenter,
    },
  },
  CorporateAccountInfoCerti: {
    screen: CorporateAccountInfoCerti,
    navigationOptions: {
      headerTitle: '对公账户信息填写',
      ...titleCenter,
    },
  },
  BusinessManageSetCerti: {
    screen: BusinessManageSetCerti,
    navigationOptions: {
      headerTitle: '企业管理员设置',
      ...titleCenter,
    },
  },
  BusinessCertiFeedBack: {
    screen: BusinessCertiFeedBack,
    navigationOptions: {
      headerTitle: '提交结果',
      ...titleCenter,
    },
  },
  B2BCorporateAccountBankSelect: {
    screen: B2BCorporateAccountBankSelect,
    ...emptyHeader,
  },
  BusinessData: {
    screen: BusinessData,
    ...emptyHeader,
  },
  B2BBusinessInfoVerify: {
    screen: B2BBusinessInfoVerify,
    navigationOptions: {
      headerTitle: '企业信息',
      ...titleCenter,
    },
  },
  B2BLegalInfoVerify: {
    screen: B2BLegalInfoVerify,
    navigationOptions: {
      headerTitle: '法人信息',
      ...titleCenter,
    },
  },
  B2BCorporateAccountInfoVerify: {
    screen: B2BCorporateAccountInfoVerify,
    navigationOptions: {
      headerTitle: '对公账户信息',
      ...titleCenter,
    },
  },
  B2BBusinessManagerSetVerify: {
    screen: B2BBusinessManagerSetVerify,
    navigationOptions: {
      headerTitle: '管理员设置',
      ...titleCenter,
    },
  },
};
